\ SEQREAD.HLP   Sequential read and load file           by Tom Zimmer


IBLEN           input buffer length constant
OBLEN           output buffer length constant
INLEN           input text length variable
INBSEG          the input buffer segment constant
OUTBUF          the line output buffer array

MAXNEST         byte size of 5 hcb's

HNDLS           an array of handles, holds 5 handles in a stack.
LOADFILE        File for source of this word.
LOADOFF         line offset of error
FILEPOINTER     most recent read
LOADING         Are we in the proccess of loading a file?

LOADSTAT        load status display defered word.

SHNDL+          ( --- A1 )
        Returns address a1, the address of the next available handle.

.FILE           ( --- )
        display the filename of the current file handle.

GET_ALINE       ( --- )
        get a line of text from the current file, and place it in the
        output buffer.

FILEPOINTER+    ( --- )
        Increment the current file pointer by the length of the line
        in outbuf.

CURPOINTER      ( handle --- double-current )
        Return the double-current offset into file handle.

SAVEPOINTER     ( --- )
        Save the file offset into the current file for later restoral.

?FILLBUFF       ( --- )
        Re-fill the input buffer if it needs it.


<LINEREAD>      ( --- a1 )
        Read a line from the current file, returning the address a1,
        the address of the next line.

LINEREAD        ( --- a1 )
        A defered word that returns a line from the current file.

(?SERROR)       ( ADDR N1 BOOL --- )
        If bool is true, then print message addr1,n1 and show the
        line in the current file where the error occured.

SEQUP           ( --- )
        Step up one handle in the handle stack.

SEQINIT         ( --- )
        Initialize the handle stack, in preparation for use.

SEQDOWN         ( --- )
        Step down one handle in the handle stack. closes the current
        file, and selects the next lower file.

CLOSE           ( --- )
        A pseudonym for SEQDOWN. See also SEQDOWN.

$HOPEN          ( A1 --- F1 )
        Open the file specified by the counted string a1. Return
        boolean f1 false if the open was succesful.

SEEK            ( d1 --- )
        Seek (move pointer) to position d1 in the current file.

LVR             ( --- a1 )
        List variable, if this variable is on, then lines of the
        current load file will be displayed while being loaded.

SHOWLINES       ( --- )
        Turn on listing of lines while loading.

HIDELINES       ( --- )
        Turn off listing of lines while loading.

: FILLTIB       ( --- )
        Set the terminal input buffer to point to a line just
        read from the current file.

<LOAD>          ( --- )
        Load the current file starting at the current file offset.

LOADER          ( --- )
        A defered word that loads the current file.

>LINE           ( n1 --- )
        Step to line n1 in the current file.

LOADED,         ( --- )
        Compile the name of the current file as a variable in the
        FILES vocabulary. Also links the variable into a list of
        variables that represent the files that have been loaded.

<FLOAD>         ( --- )
        Primitive word that loads the file just opened.

FLOAD           ( | name --- )
        load the file "name". this is nestable.

CHARREAD        ( --- c1 )
        Read a character c1 from the current file.

OK              ( --- )
        Load all of the current file.


\S              ( n1 --- )
        Stop loading the current file with the line that contains
        this word.

